package com.hl.mapper;

import com.hl.pojo.UserReview;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserReviewMapper {

    @Insert("insert into user_review (user_id,consultant_id,review_content, xing, review_time) values (#{userId}, #{consultantId}, #{reviewContent}, #{xing}, #{reviewTime})")
    Integer add(UserReview userReview);

    @Update("update user_review set user_id=#{userId},consultant_id=#{consultantId},review_content=#{reviewContent}, xing=#{xing},del=0 where id=#{id}")
    Integer update(UserReview userReview);

    @Update("update user_review set del=1 where id=#{id}")
    Integer delete(Integer id);

    @Select("select * from user_review where id=#{id} and del = 0")
    UserReview findById(Integer id);

    @Select("select * from user_review where user_id=#{userId} and del = 0")
    List<UserReview> findByUserId(Integer userId);
    @Select("select * from user_review where consultant_id=#{consultantId} and del = 0")
    List<UserReview> findByConsultantId(Integer consultantId);

    @Select("select * from user_review where del = 0")
    List<UserReview> findAll();
}